// Knockout JavaScript library v1.0
// (c) 2010 Steven Sanderson - http://knockoutjs.com/
// License: Ms-Pl (http://www.opensource.org/licenses/ms-pl.html)

var ko=window.ko={};
ko.utils=new (function(){var e=/^(\s|\u00A0)+|(\s|\u00A0)+$/g;return{arrayForEach:function(a,c){for(var b=0,d=a.length;b<d;b++)c(a[b])},arrayIndexOf:function(a,c){if(typeof a.indexOf=="function")return a.indexOf(c);for(var b=0,d=a.length;b<d;b++)if(a[b]==c)return b;return-1},arrayFirst:function(a,c,b){for(var d=0,f=a.length;d<f;d++)if(c.call(b,a[d]))return a[d];return null},arrayRemoveItem:function(a,c){var b=ko.utils.arrayIndexOf(a,c);b>=0&&a.splice(b,1)},arrayGetDistinctValues:function(a){a=a||
[];for(var c=[],b=0,d=a.length;b<d;b++)ko.utils.arrayIndexOf(c,a[b])<0&&c.push(a[b]);return c},arrayMap:function(a,c){a=a||[];for(var b=[],d=0,f=a.length;d<f;d++)b.push(c(a[d]));return b},arrayFilter:function(a,c){a=a||[];for(var b=[],d=0,f=a.length;d<f;d++)c(a[d])&&b.push(a[d]);return b},setDomNodeChildren:function(a,c){a.innerHTML="";c&&ko.utils.arrayForEach(c,function(b){a.appendChild(b)})},replaceDomNodes:function(a,c){var b=a.nodeType?[a]:a;if(b.length>0){for(var d=b[0],f=d.parentNode,g=0,h=
c.length;g<h;g++)f.insertBefore(c[g],d);g=0;for(h=b.length;g<h;g++)f.removeChild(b[g])}},getElementsHavingAttribute:function(a,c){if(!a||a.nodeType!=1)return[];var b=[];a.getAttribute(c)!==null&&b.push(a);for(var d=a.getElementsByTagName("*"),f=0,g=d.length;f<g;f++)d[f].getAttribute(c)!==null&&b.push(d[f]);return b},stringTrim:function(a){return(a||"").replace(e,"")},stringTokenize:function(a,c){for(var b=[],d=(a||"").split(c),f=0,g=d.length;f<g;f++){var h=ko.utils.stringTrim(d[f]);h!==""&&b.push(h)}return b},
evalWithinScope:function(a,c){if(c===undefined)return(new Function("return "+a))();with(c)return eval("("+a+")")},domNodeIsContainedBy:function(a,c){if(c.compareDocumentPosition)return(c.compareDocumentPosition(a)&16)==16;for(;a!=null;){if(a==c)return true;a=a.parentNode}return false},domNodeIsAttachedToDocument:function(a){return ko.utils.domNodeIsContainedBy(a,document)},registerEventHandler:function(a,c,b){if(typeof jQuery!="undefined")jQuery(a).bind(c,b);else if(typeof a.addEventListener=="function")a.addEventListener(c,
b,false);else if(typeof a.attachEvent!="undefined")a.attachEvent("on"+c,function(d){b.call(a,d)});else throw Error("Browser doesn't support addEventListener or attachEvent");},triggerEvent:function(a,c){if(!(a&&a.nodeType))throw Error("element must be a DOM node when calling triggerEvent");if(typeof a.fireEvent!="undefined")a.fireEvent("on"+c);else if(typeof document.createEvent=="function")if(typeof a.dispatchEvent=="function"){var b=document.createEvent(c=="click"?"MouseEvents":"HTMLEvents");b.initEvent(c,
true,true,window,0,0,0,0,0,false,false,false,false,0,a);a.dispatchEvent(b)}else throw Error("The supplied element doesn't support dispatchEvent");else throw Error("Browser doesn't support triggering events");},unwrapObservable:function(a){return ko.isObservable(a)?a():a},domNodeHasCssClass:function(a,c){var b=(a.className||"").split(/\s+/);return ko.utils.arrayIndexOf(b,c)>=0},toggleDomNodeCssClass:function(a,c,b){var d=ko.utils.domNodeHasCssClass(a,c);if(b&&!d)a.className=(a.className||"")+" "+c;
else if(d&&!b){b=(a.className||"").split(/\s+/);d="";for(var f=0;f<b.length;f++)if(b[f]!=c)d+=b[f]+" ";a.className=ko.utils.stringTrim(d)}},range:function(a,c){a=ko.utils.unwrapObservable(a);c=ko.utils.unwrapObservable(c);for(var b=[],d=a;d<=c;d++)b.push(d);return b}}});if(!Function.prototype.bind)Function.prototype.bind=function(e){var a=this,c=Array.prototype.slice.call(arguments);e=c.shift();return function(){return a.apply(e,c.concat(Array.prototype.slice.call(arguments)))}};
ko.memoization=function(){function e(){return((1+Math.random())*4294967296|0).toString(16).substring(1)}function a(b,d){if(b)if(b.nodeType==8){var f=ko.memoization.parseMemoText(b.nodeValue);f!=null&&d.push({domNode:b,memoId:f})}else if(b.nodeType==1){f=0;for(var g=b.childNodes,h=g.length;f<h;f++)a(g[f],d)}}var c={};return{memoize:function(b){if(typeof b!="function")throw Error("You can only pass a function to ko.memoization.memoize()");var d=e()+e();c[d]=b;return"<!--[ko_memo:"+d+"]--\>"},unmemoize:function(b,
d){var f=c[b];if(f===undefined)throw Error("Couldn't find any memo with ID "+b+". Perhaps it's already been unmemoized.");try{f.apply(null,d||[]);return true}finally{delete c[b]}},unmemoizeDomNodeAndDescendants:function(b){var d=[];a(b,d);b=0;for(var f=d.length;b<f;b++){var g=d[b].domNode;ko.memoization.unmemoize(d[b].memoId,[g]);g.nodeValue="";g.parentNode&&g.parentNode.removeChild(g)}},parseMemoText:function(b){return(b=b.match(/^\[ko_memo\:(.*?)\]$/))?b[1]:null}}}();
ko.subscription=function(e,a){this.callback=e;this.dispose=a};ko.subscribable=function(){var e=[];this.subscribe=function(a,c){var b=new ko.subscription(c?function(){a.call(c)}:a,function(){ko.utils.arrayRemoveItem(e,b)});e.push(b);return b};this.notifySubscribers=function(a){ko.utils.arrayForEach(e.slice(0),function(c){c&&c.callback(a)})};this.getSubscriptionsCount=function(){return e.length}};ko.isSubscribable=function(e){return typeof e.subscribe=="function"&&typeof e.notifySubscribers=="function"};
ko.dependencyDetection=function(){var e=[];return{begin:function(){e.push([])},end:function(){return e.pop()},registerDependency:function(a){if(!ko.isSubscribable(a))throw"Only subscribable things can act as dependencies";e.length>0&&e[e.length-1].push(a)}}}();
ko.observable=function(e){function a(b){if(arguments.length>0){c=b;a.notifySubscribers(c)}else ko.dependencyDetection.registerDependency(a);return c}var c=e;a.__ko_proto__=ko.observable;a.valueHasMutated=function(){a.notifySubscribers(c)};ko.subscribable.call(a);return a};ko.isObservable=function(e){if(e===null||e===undefined||e.__ko_proto__===undefined)return false;if(e.__ko_proto__===ko.observable)return true;return ko.isObservable(e.__ko_proto__)};
ko.isWriteableObservable=function(e){return typeof e=="function"&&e.__ko_proto__===ko.observable};
ko.observableArray=function(e){var a=new ko.observable(e);ko.utils.arrayForEach(["pop","push","reverse","shift","sort","splice","unshift"],function(c){a[c]=function(){var b=a();b=b[c].apply(b,arguments);a.valueHasMutated();return b}});ko.utils.arrayForEach(["slice"],function(c){a[c]=function(){var b=a();return b[c].apply(b,arguments)}});a.remove=function(c){for(var b=a(),d=[],f=[],g=typeof c=="function"?c:function(k){return k===c},h=0,i=b.length;h<i;h++){var j=b[h];g(j)?f.push(j):d.push(j)}a(d);return f};
a.removeAll=function(c){if(!c)return[];return a.remove(function(b){return ko.utils.arrayIndexOf(c,b)>=0})};a.indexOf=function(c){var b=a();return ko.utils.arrayIndexOf(b,c)};return a};
ko.dependentObservable=function(e,a,c){function b(){ko.utils.arrayForEach(h,function(k){k.dispose()});h=[]}function d(k){b();ko.utils.arrayForEach(k,function(l){h.push(l.subscribe(f))})}function f(){if(!j&&c&&typeof c.disposeWhen=="function")if(c.disposeWhen()){g.dispose();return}try{ko.dependencyDetection.begin();i=a?e.call(a):e()}catch(k){throw k;}finally{var l=ko.utils.arrayGetDistinctValues(ko.dependencyDetection.end());d(l)}g.notifySubscribers(i);j=false}function g(){if(arguments.length>0)throw"Cannot write a value to a dependentObservable. Do not pass any parameters to it";
ko.dependencyDetection.registerDependency(g);return i}if(typeof e!="function")throw"Pass a function that returns the value of the dependentObservable";var h=[],i,j=true;g.__ko_proto__=ko.dependentObservable;g.getDependenciesCount=function(){return h.length};g.dispose=function(){b()};ko.subscribable.call(g);f();return g};ko.dependentObservable.__ko_proto__=ko.observable;
ko.jsonExpressionRewriting=function(){function e(b,d){return b.replace(a,function(f,g){return d[g]})}var a=/\[ko_token_(\d+)\]/g,c=/^[\_$a-z][\_$a-z]*(\[.*?\])*(\.[\_$a-z][\_$a-z]*(\[.*?\])*)*$/i;return{parseJson:function(b){b=ko.utils.stringTrim(b);if(b.length<3)return{};for(var d=[],f=null,g,h=b.charAt(0)=="{"?1:0;h<b.length;h++){var i=b.charAt(h);if(f===null)switch(i){case '"':case "'":case "/":f=h;g=i;break;case "{":f=h;g="}";break;case "[":f=h;g="]";break}else if(i==g){i=b.substring(f,h+1);d.push(i);
var j="[ko_token_"+(d.length-1)+"]";b=b.substring(0,f)+j+b.substring(h+1);h-=i.length-j.length;f=null}}f={};b=b.split(",");g=0;for(h=b.length;g<h;g++){j=b[g];var k=j.indexOf(":");if(k>0&&k<j.length-1){i=ko.utils.stringTrim(j.substring(0,k));j=ko.utils.stringTrim(j.substring(k+1));if(i.charAt(0)=="{")i=i.substring(1);if(j.charAt(j.length-1)=="}")j=j.substring(0,j.length-1);i=ko.utils.stringTrim(e(i,d));j=ko.utils.stringTrim(e(j,d));f[i]=j}}return f},insertPropertyAccessorsIntoJson:function(b){var d=
ko.jsonExpressionRewriting.parseJson(b),f=[];for(var g in d){var h=d[g];if(h.match(c)!==null){f.length>0&&f.push(", ");f.push(g+" : function(__ko_value) { "+h+" = __ko_value; }")}}if(f.length>0){d=f.join("");b=b+", '_ko_property_writers' : { "+d+" } "}return b}}}();
(function(){ko.bindingHandlers={};ko.applyBindingsToNode=function(e,a,c){var b=true;new ko.dependentObservable(function(){var d;if(!(d=typeof a=="function"?a():a)){var f=e.getAttribute("data-bind");try{var g=" { "+ko.jsonExpressionRewriting.insertPropertyAccessorsIntoJson(f)+" } ";d=ko.utils.evalWithinScope(g,c===null?window:c)}catch(h){throw Error("Unable to parse binding attribute.\nMessage: "+h+";\nAttribute value: "+f);}}d=d;for(var i in d)if(ko.bindingHandlers[i]){b&&typeof ko.bindingHandlers[i].init==
"function"&&ko.bindingHandlers[i].init(e,d[i],d,c);typeof ko.bindingHandlers[i].update=="function"&&ko.bindingHandlers[i].update(e,d[i],d,c)}},null,{disposeWhen:function(){return!ko.utils.domNodeIsAttachedToDocument(e)}});b=false};ko.applyBindings=function(e,a){var c=ko.utils.getElementsHavingAttribute(e,"data-bind");ko.utils.arrayForEach(c,function(b){ko.applyBindingsToNode(b,null,a)})}})();
ko.bindingHandlers.click={init:function(e,a,c,b){ko.utils.registerEventHandler(e,"click",function(d){try{a.call(b)}finally{if(d.preventDefault)d.preventDefault();else d.returnValue=false}})}};ko.bindingHandlers.submit={init:function(e,a,c,b){if(typeof a!="function")throw Error("The value for a submit binding must be a function to invoke on submit");ko.utils.registerEventHandler(e,"submit",function(d){try{a.call(b)}finally{if(d.preventDefault)d.preventDefault();else d.returnValue=false}})}};
ko.bindingHandlers.visible={update:function(e,a){a=ko.utils.unwrapObservable(a);var c=e.style.display!="none";if(a&&!c)e.style.display="";else if(!a&&c)e.style.display="none"}};ko.bindingHandlers.enable={update:function(e,a){if((a=ko.utils.unwrapObservable(a))&&e.disabled)e.removeAttribute("disabled");else if(!a&&!e.disabled)e.disabled=true}};ko.bindingHandlers.disable={update:function(e,a){ko.bindingHandlers.enable.update(e,!ko.utils.unwrapObservable(a))}};
ko.bindingHandlers.value={init:function(e,a,c){var b=c.valueUpdate||"change";if(ko.isWriteableObservable(a))ko.utils.registerEventHandler(e,b,function(){a(this.value)});else c._ko_property_writers&&c._ko_property_writers.value&&ko.utils.registerEventHandler(e,b,function(){c._ko_property_writers.value(this.value)})},update:function(e,a){var c=ko.utils.unwrapObservable(a);if(c!=e.value){var b=function(){e.value=c};b();e.tagName=="SELECT"&&setTimeout(b,0)}}};
ko.bindingHandlers.options={update:function(e,a,c){if(e.tagName!="SELECT")throw Error("values binding applies only to SELECT elements");var b=ko.utils.arrayMap(ko.utils.arrayFilter(e.childNodes,function(i){return i.tagName&&i.tagName=="OPTION"&&i.selected}),function(i){return i.value||i.innerText||i.textContent});a=ko.utils.unwrapObservable(a);e.innerHTML="";if(a){if(typeof a.length!="number")a=[a];for(var d=0,f=a.length;d<f;d++){var g=document.createElement("OPTION"),h=typeof c.options_value=="string"?
a[d][c.options_value]:a[d];g.value=h.toString();g.innerHTML=(typeof c.options_text=="string"?a[d][c.options_text]:h).toString();e.appendChild(g)}e=e.getElementsByTagName("OPTION");d=0;for(f=e.length;d<f;d++)if(ko.utils.arrayIndexOf(b,e[d].value)>=0)e[d].selected=true}}};
ko.bindingHandlers.selectedOptions={getSelectedValuesFromSelectNode:function(e){var a=[];e=e.childNodes;for(var c=0,b=e.length;c<b;c++){var d=e[c];d.tagName=="OPTION"&&d.selected&&a.push(d.value)}return a},init:function(e,a,c){if(ko.isWriteableObservable(a))ko.utils.registerEventHandler(e,"change",function(){a(ko.bindingHandlers.selectedOptions.getSelectedValuesFromSelectNode(this))});else c._ko_property_writers&&c._ko_property_writers.value&&ko.utils.registerEventHandler(e,"change",function(){c._ko_property_writers.value(ko.bindingHandlers.selectedOptions.getSelectedValuesFromSelectNode(this))})},
update:function(e,a){if(e.tagName!="SELECT")throw Error("values binding applies only to SELECT elements");var c=ko.utils.unwrapObservable(a);if(c&&typeof c.length=="number")for(var b=e.childNodes,d=0,f=b.length;d<f;d++){var g=b[d];if(g.tagName=="OPTION")g.selected=ko.utils.arrayIndexOf(c,g.value)>=0}}};ko.bindingHandlers.text={update:function(e,a){a=ko.utils.unwrapObservable(a);typeof e.innerText=="string"?e.innerText=a:e.textContent=a}};
ko.bindingHandlers.css={update:function(e,a){a=a||{};for(var c in a)if(typeof c=="string"){var b=ko.utils.unwrapObservable(a[c]);ko.utils.toggleDomNodeCssClass(e,c,b)}}};
ko.templateEngine=function(){this.renderTemplate=function(){throw"Override renderTemplate in your ko.templateEngine subclass";};this.isTemplateRewritten=function(){throw"Override isTemplateRewritten in your ko.templateEngine subclass";};this.rewriteTemplate=function(){throw"Override rewriteTemplate in your ko.templateEngine subclass";};this.createJavaScriptEvaluatorBlock=function(){throw"Override createJavaScriptEvaluatorBlock in your ko.templateEngine subclass";}};
ko.templateRewriting=function(){var e=/(<[a-z]+(\s+(?!data-bind=)[a-z0-9]+(=(\"[^\"]*\"|\'[^\']*\'))?)*\s+)data-bind=(["'])(.*?)\5/g;return{ensureTemplateIsRewritten:function(a,c){c.isTemplateRewritten(a)||c.rewriteTemplate(a,function(b){return ko.templateRewriting.memoizeBindingAttributeSyntax(b,c)})},memoizeBindingAttributeSyntax:function(a,c){return a.replace(e,function(b,d,f,g,h,i,j){b=j;b=ko.jsonExpressionRewriting.insertPropertyAccessorsIntoJson(b);return c.createJavaScriptEvaluatorBlock("ko.templateRewriting.applyMemoizedBindingsToNextSibling(function() {                     return (function() { return { "+
b+" } })()                 })")+d})},applyMemoizedBindingsToNextSibling:function(a){return ko.memoization.memoize(function(c){c.nextSibling&&ko.applyBindingsToNode(c.nextSibling,a,null)})}}}();
(function(){function e(c,b,d,f,g){f=ko.isObservable(f)?f():f;var h=g.templateEngine||a;ko.templateRewriting.ensureTemplateIsRewritten(d,h);d=h.renderTemplate(d,f,g);if(typeof d.length!="number"||d.length>0&&typeof d[0].nodeType!="number")throw"Template engine must return an array of DOM nodes";d&&ko.utils.arrayForEach(d,function(i){ko.memoization.unmemoizeDomNodeAndDescendants(i)});switch(b){case "replaceChildren":ko.utils.setDomNodeChildren(c,d);break;case "replaceNode":ko.utils.replaceDomNodes(c,
d);break;default:throw Error("Unknown renderMode: "+b);}return d}var a;ko.setTemplateEngine=function(c){if(c!=undefined&&!(c instanceof ko.templateEngine))throw"templateEngine must inherit from ko.templateEngine";a=c};ko.renderTemplate=function(c,b,d,f,g){d=d||{};if((d.templateEngine||a)==undefined)throw"Set a template engine before calling renderTemplate";g=g||"replaceChildren";if(f){var h=f.nodeType?f:f.length>0?f[0]:null;return new ko.dependentObservable(function(){var i=e(f,g,c,b,d||{});if(g==
"replaceNode"){f=i;h=f.nodeType?f:f.length>0?f[0]:null}},null,{disposeWhen:function(){return!h||!ko.utils.domNodeIsAttachedToDocument(h)}})}else return ko.memoization.memoize(function(i){ko.renderTemplate(c,b,d,i,"replaceNode")})};ko.bindingHandlers.template={update:function(c,b,d,f){ko.renderTemplate(b,typeof d.data=="undefined"?f:d.data,null,c)}}})();
ko.jqueryTmplTemplateEngine=function(){function e(a){var c=document.getElementById(a);if(c==null)throw Error("Cannot find template with ID="+a);return c}this.renderTemplate=function(a,c){return $.tmpl(e(a).text,c)};this.isTemplateRewritten=function(a){return e(a).isRewritten===true};this.rewriteTemplate=function(a,c){var b=e(a),d=c(b.text);b.text=d;b.isRewritten=true};this.createJavaScriptEvaluatorBlock=function(a){return"{{= "+a+"}}"};this.addTemplate=function(a,c){document.write("<script type='text/html' id='"+
a+"'>"+c+"<\/script>")}};ko.jqueryTmplTemplateEngine.prototype=new ko.templateEngine;ko.setTemplateEngine(new ko.jqueryTmplTemplateEngine);
